#include "Xps/Message/PingMessage.h"
#include "Xps/Message/ACKMessage.h"

namespace Xps
{

    ACKMessage::ACKMessage(void)
        :time_elapsed(0)
    {
    }

    ACKMessage::ACKMessage( const PingMessage *_PingMessage )
    {        
        long current_time = clock();
        time_elapsed = current_time - _PingMessage->created_time;
    }

    ObjectType ACKMessage::getType() const
    {
        return ACK_MESSAGE;
    }

    void ACKMessage::serialize( boost::archive::binary_oarchive & ar, const unsigned int version )
    {
        serialize(ar);
    }

    void ACKMessage::serialize( boost::archive::binary_iarchive & ar, const unsigned int version )
    {
        serialize(ar);
    }

    const float ACKMessage::getTimeElapsed() const
    {
        return ((float)time_elapsed)/CLOCKS_PER_SEC;
    }
};